<template>
	<view>
		<view class="list">
			<xy-list-item
				:key="item.id"
				v-for="item in dataList"
				type="media"
				:image="item.itemInfo.cover"
				:title="item.itemInfo.title"
				contentStyle="align-self: flex-start"
				:url="'/pages/scoreshop/order/info?id=' + item.id"
				titleFs="15px">
				<view slot="titleRight">
					<view v-if="item.deliverCompany">
						已发货
					</view>
					<view v-else>
						待发货
					</view>
				</view>
				<template slot="info">
					<view class="left p-t-xs text-gray" style="width: 100%;">
						<view class="des m-b-xs">
							<view v-if="item.deliverCompany">
								配送信息：{{item.deliverCompany}} {{item.deliverNo}}
							</view>
							<view v-else>
								暂无配送信息
							</view>
						</view>
						<view class="price flex" style="justify-content: space-between;">
							<view class="font-md text-error">
								-{{item.price}}积分
							</view>
							<view class="font-sm p-t-xs">
								{{item.createTime | formatTime}}
							</view>
						</view>
					</view>
				</template>
			</xy-list-item>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: []
			};
		},
		onLoad() {
			this.loadData();
		},
		methods: {
			async loadData() {
				uni.showLoading({
					tilte: '加载中...'
				});
				let res = await this.util.request({
					url: '/v1/scoreshop/order/my',
					method: 'get'
				});
				if (res.code == 200) {
					this.dataList = res.data.dataList;
				} else {
					this.util.showToast({
						title: res.msg,
						icon: 'loading',
						duration: 2000
					});
				}
				uni.hideLoading();
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
